<template>
  <ul class="goods-list-top" v-if="goods.length">
    <li v-for="item in goods" :key="item.id">
      <RouterLink to="/">
        <img v-ilazy="item.picture" :src="load" alt="" />
        <!-- 商品名称 -->
        <p class="name">{{ item.title || item.name }}</p>
        <p :class="{ desc: item.alt, price: item.price }">
          <span v-if="item.price">￥</span>{{ item.alt || item.price }}
        </p>
      </RouterLink>
    </li>
  </ul>
 <ul class="goods-li  st-top" v-else>
    <li v-for="i in 4" :key="i">
      <p><XtxSkeleton width="306" height="306" bg="#eee" /></p>
      <p>
        <XtxSkeleton width="306" height="32" bg="#eee" />
      </p>
      <p>
        <XtxSkeleton width="306" height="32" bg="#eee" />
      </p>
    </li>
  </ul>
</template>

<script>
export default {
  props: {
    goods: {
      type: Array,
      default: () => []
    }
  }
}
</script>

<style lang="less" scoped>
// 首页商品列表
.goods-list-top {
  display: flex;
  justify-content: space-between;
  height: 426px;
  li {
    width: 306px;
    height: 406px;
    // 激活效果
    transition: all 0.5s;
    &:hover {
      transform: translate3d(0, -6px, 0);
      box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
    }
    // end
    img {
      width: 306px;
      height: 306px;
    }
    p {
      font-size: 22px;
      padding-top: 12px;
      text-align: center;
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
    }
    .desc {
      color: #999;
      font-size: 18px;
    }
    .price {
      color: @priceColor;
    }
  }
}
</style>
